﻿using System;
using GFCTP;
using System.IO;
using CSCTP;

namespace VolatilityStrategy
{

    public class BoDong : Strategy
    {
        public BoDong()
        {
        }

        [Parameter("","倍数")]
        double N = 1.5;
        [Parameter("","ATR参数")]
        int ATRLen = 10;
        [Parameter("","持仓时间")]
        int Len = 10;

        BarSeries TR = new BarSeries();
        BarSeries ATR = new BarSeries();

        public void Init()
        {
            //ATR = new SMA(TR, ATRLen).Value;
        }

        public override void OnBarUpdate()
        { 
            //TR[0] = Math.Max(Math.Max((H[0] - L[0]), Math.Abs(C[1] - H[0])), Math.Abs(C[1] - L[0]));            
            //if (CurrentBar > ATRLen)
            //{
            //    if (this.PositionNet == 0)
            //    {
            //        if (C[1] > C[2] + ATR[1] * N) { Buy(1, O[0]); }
            //        else if (C[1] < C[2] - ATR[1] * N) { SellShort(1, O[0]); }
            //    }
            //    else if (this.PositionNet > 0)
            //    {
            //        if (this.BarsSinceEntryLong == Len) { Sell(1, O[0]); }
            //    }
            //    else if (this.PositionNet < 0)
            //    {
            //        if (this.BarsSinceEntryShort == Len) { BuyToCover(1, O[0]); }
            //    }
            //}
        }
    }

}
